package com.bjsxt.usersCenter.common.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RequestMapping;

import com.bjsxt.usersCenter.common.util.VerifyCodeUtils;

public class BaseController
{
	protected String info; 
	
	
	@RequestMapping("/randImg")
	public String randImg(HttpServletRequest request,HttpServletResponse response) throws IOException
	{
		response.setHeader("Pragma", "No-cache");
		response.setHeader("Cache-Control", "No-cache");
		response.setDateHeader("Expires", 0);
		response.setContentType("image/jpeg");
		
		String verfyCode=VerifyCodeUtils.generateVerifyCode(4);
		
		HttpSession session=request.getSession(true);
		session.setAttribute("rand", verfyCode.toLowerCase());
		int w=200,h=80;
		
		VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verfyCode);
		
		return null;
	}
}
